package com.eunion.web.admin.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import java.util.Date;

/**
 * 系统权限
 */
@Entity
@Table(name = "admin_auth")
public class AdminAuth implements Serializable {

    private static final long serialVersionUID = 1L;

    private static final String OBJ_NAME = "权限";

    /**
     * 权限代码，英文
     */
    @NotNull(message = OBJ_NAME + "代码非法")
    @NotEmpty(message = OBJ_NAME + "代码不能为空")
    @Size(min = 2, max = 50, message = OBJ_NAME + "代码长度非法2-50")
    @Pattern(regexp = "^[a-zA-Z0-9_:]{2,50}$", message = OBJ_NAME + "代码仅允许2－50位英文及数字或下划线冒号")
    @Id
    @Column(name = "auth_code")
    private String authCode;

    /**
     * 权限名称
     */
    @NotNull(message = OBJ_NAME + "名字非法")
    @NotEmpty(message = OBJ_NAME + "名字不能为空")
    @Size(min = 2, max = 20, message = OBJ_NAME + "名字长度非法2-20")
    @Column(name = "auth_name")
    private String authName;

    /**
     * 状态，0：停用，1：启用
     */
    @NotNull(message = OBJ_NAME + "状态非法")
    private Integer status;

    /**
     * 权限地址
     */
    @Column(name = "auth_url")
    private String authUrl;

    /**
     * 权限序号
     */
    @NotNull(message = OBJ_NAME + "序号不能为空")
    @Column(name = "auth_seq")
    private Integer authSeq;

    /**
     * 权限类型，1：menu，2：button
     */
    // @NotNull(message = OBJ_NAME + "类型非法")
    @Column(name = "auth_type")
    private Integer authType;

    /**
     * 创建时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_time")
    private Date createdTime;

    /**
     * 更新时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updated_time")
    private Date updatedTime;

    /**
     * 父级权限代码
     */
    @NotNull(message = OBJ_NAME + "父代码非法")
    @NotEmpty(message = OBJ_NAME + "父代码不能为空")
    @Size(min = 2, max = 50, message = OBJ_NAME + "父代码长度非法2-50")
    @Pattern(regexp = "^[a-zA-Z0-9_:]{2,50}$", message = OBJ_NAME + "父代码仅允许2－50位英文及数字或下划线冒号")
    @Column(name = "parent_auth_code")
    private String parentAuthCode;

    public AdminAuth() {
    }

    public String getAuthCode() {
        return authCode;
    }

    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }

    public String getAuthName() {
        return authName;
    }

    public void setAuthName(String authName) {
        this.authName = authName;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getAuthUrl() {
        return authUrl;
    }

    public void setAuthUrl(String authUrl) {
        this.authUrl = authUrl;
    }

    public Integer getAuthSeq() {
        return authSeq;
    }

    public void setAuthSeq(Integer authSeq) {
        this.authSeq = authSeq;
    }

    public Integer getAuthType() {
        return authType;
    }

    public void setAuthType(Integer authType) {
        this.authType = authType;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getParentAuthCode() {
        return parentAuthCode;
    }

    public void setParentAuthCode(String parentAuthCode) {
        this.parentAuthCode = parentAuthCode;
    }

}
